#include "processor.h"

processing_element::processing_element(unsigned int iq_size,
									   unsigned int issue_width,
									   processor *top,
									   unsigned int ID):IQ_INT(iq_size), IQ_FP(iq_size)
{

	this->issue_width = issue_width;

	/////////////////////////////////////////////////////////////
	// Execution Lanes.
	/////////////////////////////////////////////////////////////
	Execution_Lanes = new lane[issue_width];
	//IQ_INT = new issue_queue(iq_size);
	//IQ_FP = new issue_queue(iq_size);

	//Local Register File
	localRegistersInt = (unsigned long long *) malloc (LOCAL_INT_REGS * sizeof(unsigned long long));
	localRegistersFp = (unsigned long long *) malloc (LOCAL_FP_REGS * sizeof(unsigned long long));
	free = true;
	my_ID = ID;
	//myLSU = &LSU;
	/*my_ren_int = &REN_INT;
	my_ren_fp = &REN_FP;*/

	top_level = top;
}

/* unsigned long long processing_element::read(unsigned int local_reg)
{
	return localRegisters[local_reg];
}

void processing_element::write(unsigned int phys_reg, unsigned long long value)
{
	localRegisters[phys_reg] = value;
} */

bool processing_element::is_free()
{
	return free;
}

void processing_element::set_free(){
	free = true;
}

void processing_element::clear_free()
{
	free = false;
}

void processing_element::wakeup_int(unsigned int phys_reg)
{
	IQ_INT.wakeup(true, phys_reg);
}

void processing_element::wakeup_fp(unsigned int phys_reg)
{
	IQ_FP.wakeup(true, phys_reg);
}

